package testIntergration;

import static org.junit.Assert.assertEquals;

import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Random;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import FamilyTherapy.GCWindow;
import FamilyTherapy.Player;
import FamilyTherapy.Board;
import FamilyTherapy.SayActCard;

import FamilyTherapy.Game;

public class testGame_drawMT {

	@Before
	public void setUp() throws Exception {
	}

	@After
	public void tearDown() throws Exception {
	}

	@Test
	public void testDrawMT() throws Exception {
		int currentPlayerNo = 1;
		boolean holdingCard= false;
		Player[] p = { new Player("a", 1), new Player("b", 2) };

		// output
		final ByteArrayOutputStream outContent = new ByteArrayOutputStream();
		System.setOut(new PrintStream(outContent));
		

		Game game = new Game();

		Method drawMTmothod = game.getClass().getDeclaredMethod(
				"drawMT",int.class, Player[].class);
		

		ArrayList before= p[0].getHoldingCard();
		
		drawMTmothod.setAccessible(true);
		drawMTmothod.invoke(game, currentPlayerNo, p);
		drawMTmothod.setAccessible(false);
	
		if(before.equals(p[0].getHoldingCard()))
			holdingCard=true;

		//String expected = "You have drawn the : C5_Assign Descsion Maker"+ newLine;	
		//assertEquals(expected, outContent.toString());
		assertEquals(true, holdingCard);

	}
	

	 

} 
